# fedora-messaging consumer configuration file for the production
# openQA ResultsDB reporter. Note you must change the UUID here to
# something unique before using this.
#
# This file is in the TOML format.

amqp_url = "{{ openqa_amqp_reporter_url }}"
{% if openqa_amqp_passive|bool %}
passive_declares = true
{% endif %}
callback = "fedora_openqa.consumer:OpenQAResultsDBReporter"

[tls]
ca_cert = "{{ openqa_amqp_reporter_cacert }}"
keyfile = "{{ openqa_amqp_reporter_key }}"
certfile = "{{ openqa_amqp_reporter_cert }}"

[client_properties]
app = "Fedora openQA ResultsDB reporter"
app_url = "https://pagure.io/fedora-qa/fedora_openqa"
app_contacts_email = ["adamwill@fedoraproject.org", "lruzicka@redhat.com", "qa-devel@lists.fedoraproject.org"]

[exchanges."amq.topic"]
type = "topic"
durable = true
auto_delete = false
arguments = {}

[queues."{{ openqa_amqp_resultsdb_reporter_queue }}"]
durable = false
auto_delete = true
exclusive = true
arguments = {}

[[bindings]]
queue = "{{ openqa_amqp_resultsdb_reporter_queue }}"
exchange = "amq.topic"
routing_keys = [{% for key in openqa_amqp_resultsdb_reporter_routing_keys %}"{{ key }}",{% endfor %}]
# need this to receive messages from ZMQ->AMQP bridge
[[bindings]]
queue = "{{ openqa_amqp_resultsdb_reporter_queue }}"
exchange = "zmq.topic"
routing_keys = [{% for key in openqa_amqp_resultsdb_reporter_routing_keys %}"{{ key }}",{% endfor %}]

[consumer_config]
openqa_hostname = "{{ openqa_hostname }}"
openqa_baseurl = "https://{{ external_hostname|default(ansible_nodename) }}"
resultsdb_url = "{{ openqa_resultsdb_url }}"
do_report = true

[qos]
prefetch_size = 0
prefetch_count = 25

[log_config]
version = 1
disable_existing_loggers = true

[log_config.formatters.simple]
format = "[%(levelname)s %(name)s] %(message)s"

[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"

{% if openqa_amqp_mailto is defined %}
[log_config.handlers.email]
class = "logging.handlers.SMTPHandler"
formatter = "simple"
level = "ERROR"
mailhost = "{{ openqa_amqp_smtp }}"
fromaddr = "{{ openqa_amqp_mailfrom }}"
toaddrs = [{% for key in openqa_amqp_mailto %}"{{ key }}",{% endfor %}]
subject = "openQA ResultsDB reporter error"
{% endif %}

[log_config.loggers.OpenQAResultsDBReporter]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.fedora_messaging]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.twisted]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.pika]
level = "WARNING"
propagate = false
handlers = ["console"]

[log_config.loggers.fedora_openqa]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.root]
level = "ERROR"
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}
